Home:ALL Converter>"Cannot generate SSPI context" Issue when connecting MS SQL Server by Python

"Cannot generate SSPI context" Issue when connecting MS SQL Server by Python

Ask Time:2022-02-23T14:48:47         Author:Дмитрий Сажнев

Json Formatter

I'm trying to connect a database by using python pyodbc library. And I have the following error:

pyodbc.Error: ('HY000', '[HY000] [Microsoft][SQL Server Native Client 11.0]SQL Server Network Interfaces: The logon attempt failed\r\n (-2146893044) (SQLDriverConnect); [HY000

] [Microsoft][SQL Server Native Client 11.0]Cannot generate SSPI context (-2146893044); [HY000] [Microsoft][SQL Server Native Client 11.0]SQL Server Network Interfaces: The lo gon attempt failed\r\n (-2146893044); [HY000] [Microsoft][SQL Server Native Client 11.0]Cannot generate SSPI context (-2146893044)')

I'm using regular login/password authentcation and it works on the same machine when connecting by MS SQL Management Studio. And it also works fine when I run the same Python script with same credentials on different machine

Author:Дмитрий Сажнев,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/71232433/cannot-generate-sspi-context-issue-when-connecting-ms-sql-server-by-python
yy